package edu.ufl.cise.cop5555.sp12; 
 
import static edu.ufl.cise.cop5555.sp12.Kind.*;
import static org.junit.Assert.*; 
 
import org.junit.Test; 
 
import edu.ufl.cise.cop5555.sp12.TokenStream; 
import edu.ufl.cise.cop5555.sp12.Scanner;
import edu.ufl.cise.cop5555.sp12.Parser;
import edu.ufl.cise.cop5555.sp12.SyntaxException;
import edu.ufl.cise.cop5555.sp12.ast.AST;
import edu.ufl.cise.cop5555.sp12.ast.ToStringVisitor;
 
public class TestSimpleParser { 
    
    private TokenStream getInitializedTokenStream(String input) { 
        TokenStream stream = new TokenStream(input); 
        Scanner s = new Scanner(stream); 
        s.scan(); 
        return stream; 
    } 
     
     
    @Test 
    public void testEmptyProg(){ 
        String input = "prog Test1 gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
		try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
		
    } 
     
    @Test 
    public void testIntDec1(){ 
        String input = "prog Test1 int x; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}; 
    } 
     
    @Test 
    public void testBooleanDec1(){ 
        String input = "prog Test1 boolean x; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}; 
    } 
     
  @Test 
    public void testMapDeca(){ 
        String input = "prog Test1 map[int,string] y; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}; 
    } 
     
   @Test 
    public void testMapDec21(){ 
        String input = "prog Test1 map[int,map[string,boolean]] m; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}; 
    } 
     
  @Test 
    public void xtestMapDec22(){ 
        String input = "prog Test1 map[int,map[string,boolean]] ; gorp";  //semi is the error, should be ident 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
       /* SyntaxException result = parser.parse(); 
        assertNotNull(result); 
        System.out.println(result.getMessage());
        assertEquals(SEMI, result.t.kind);*/
        
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNotNull(e); 
		        
		        assertEquals(SEMI, e.t.kind);
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
    } 
   @Test 
    public void Test1() 
    { 
        String input = "prog k  gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
     
    @Test 
    public void Test2() 
    { 
        String input = "gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
       // SyntaxException result = parser.parse(); 
      //  assertNotNull(result); 
        //System.out.println(result.getMessage());
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNotNull(e); 
			  assertEquals(GORP, e.t.kind);
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
     
    @Test 
    public void Test3() 
    { 
        String input = "prog Test ; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
    } 
   @Test 
    public void Test4() 
    { 
        String input = "prog Test int a; int b; ; ;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
    @Test 
    public void Test5() 
    { 
        String input = "prog Test a[true] = truegorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNotNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
    @Test 
    public void Test6() 
    { 
        String input = "prog Test1 do println: [x1 , x2] println x1;  od; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNotNull(e); 
		       assertEquals(Kind.PRINTLN, e.t.kind);
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
    @Test 
    public void Test7() 
    { 
        String input = "prog Test a[true] = true; ;;;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
    } 
     
   @Test 
    public void Test8() 
    { 
        String input = "prog Test int a; boolean b;string s;map[int,int] m; map[int,map[int , boolean ] ] m; map[int,map[boolean,map[string,string]]] m;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
     
    @Test 
    public void Test9() 
    { 
        String input = "prog Test a = b & b -2; print \"abc\"+2;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
    @Test 
    public void Test10() 
    { 
        String input = "prog Test if(2* \"abc\") ; fi ;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
         
    } 
     
    @Test 
    public void Test11() 
    { 
        String input = "prog Test if(2* \"abc\") ; else ; fi ;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
   @Test 
    public void Test12() 
    { 
        String input = "prog Test int a; boolean b; string c; do b : [a,b] od; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
     
    @Test 
    public void Test13() 
    { 
        String input = "prog Test do (2* 5 + a[\"abc\"] == true ) od;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
    //    SyntaxException result = parser.parse(); 
     //   assertNull(result);
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
     
  @Test 
    public void Test14() 
    { 
        String input = "prog Test a[2/ \"a\"] = {} ;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
         AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
          
         
    } 
    @Test 
    public void Test15() 
    { 
        String input = "prog Test a[(!2)] = {[2,false] , [2,2] }; a = 2;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}     
         
    } 
     
    @Test 
    public void Test16() 
    { 
        String input = "prog Test int a; a = 2 ;  int a; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
         
    } 
     
    @Test 
    public void Test17() 
    { 
        String input = "prog Test int a;map[boolean,int] b;;a=b*c*5 <= true; a[-true*\"a\"] = {[true,false],[(2),(2*5)] }; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		} 
         
    } 
     
     
    @Test 
    public void Test18() 
    { 
        String input = "prog Test a[a] = a; a[a[b]] = c; a[a[a]] = c[b]; a =2; a = true; a[!(b[true])] = true; a = {}; a = {[(2),(4)]}; do a : [a,b] print a;int a ; od;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}      
         
    } 
   @Test 
    public void Test19() 
    { 
        String input = "prog Test do (a!=b); od; do(a<b);od; do(a>b);od;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}         
         
    } 
    
    @Test 
    public void Test20() 
    { 
        String input = "prog Test do ((true) * (false)) ;od;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}      
    } 
    
    @Test 
    public void Test21() 
    { 
        String input = "prog Test a = \"av gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNotNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}      
         
    } 
    
    @Test 
    public void Test22() 
    { 
        String input = "prog Test a = \"av\"; ##New comment## a = a/b*c-!true; do n[2]:[a,b] ; od;gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}           
         
    } 
    @Test 
    public void Test23() 
    { 
        String input = "prog Test1 do println : [x1 , x2] print x1;  od; gorp"; 
        TokenStream stream = getInitializedTokenStream(input); 
        Parser parser = new Parser(stream); 
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNotNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}      
         
    } 
  
    @Test
    public void xtestMapDec28a(){
        String input = "prog main int x;boolean y;map[string,string] mapHash;x=12;x=12*3;y={};y={[x+y,10/12]};y[10]=20; print hello; println xyz*3;do(x>y) string new;new=\"Hello World\"; od;  do x:[y,z] y=y+z*20; od; if(g>s) mapHash[x]=y; fi; if(g<=s) mapHash[y]=x; else mapHash[x]=y; fi; x=x & !y; x=x-y; x=(x-y*20)/20; gorp";  //This should pass without any errors
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST ast;
        try {
			ast = parser.parse();
			ToStringVisitor pv = new ToStringVisitor();
			 ast.visit(pv,""); 
			 String st = pv.getString(); 
			 System.out.println(st);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			  assertNull(e); 
		        
		       
			System.out.println(e.getMessage());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}      
    
        }

    @Test
	public void testIntDec(){
		String input = "prog Test1 int x; gorp";
		TokenStream stream = getInitializedTokenStream(input);
		Parser parser = new Parser(stream);
		AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void testBooleanDec(){
		String input = "prog Test1 boolean x; gorp";
		TokenStream stream = getInitializedTokenStream(input);
		Parser parser = new Parser(stream);
		AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void testMapDec(){
		String input = "prog Test1 map[int,string] y; gorp";
		TokenStream stream = getInitializedTokenStream(input);
		Parser parser = new Parser(stream);
		AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void testMapDec2(){
		String input = "prog Test1 map[int,map[string,boolean]] m;\n int x; \n x=2+(3*4); gorp";
		TokenStream stream = getInitializedTokenStream(input);
		Parser parser = new Parser(stream);
		AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void xtestMapDec2(){
		String input = "prog Test1 map[int,map[string,boolean]]n ; gorp";  //semi is the error, should be ident
		TokenStream stream = getInitializedTokenStream(input);
		Parser parser = new Parser(stream);
		AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public void xtestMapDec23(){
        String input = "prog mainprog abc={[5*4-6>8,5/4+6<8]}; gorp";  //semi is the error, should be ident
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        }
    @Test
    public void xtestMapDec24(){
        String input = "prog mainprog do(5*4+6>8) abc={[5*4-6>8,5/4+6<8]}; od;  gorp";  //semi is the error, should be ident
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        }
    @Test
    public void xtestMapDec25(){
        String input = "prog mainprog do(5*4+6>8) abc={[5*4-6>8,5/4+6<8]}; od ; gorp";  
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}        //assertEquals(SEMI, result.t.kind);
        }
    @Test
    public void xtestMapDec26(){
        String input = "prog mainprog do abc:[x,y] map[int,int] xyz; do(5*4+6>8) abc=5*4-6+5/4+6; od; od; gorp";  //semi is the error, should be ident
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        }
    @Test
    public void xtestMapDec27(){
        String input = "prog mainprog if(5*4-6<=89) println 5+9; print 8<=9; else do abc:[icd,bhg] od; fi;   gorp";  //semi is the error, should be ident
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    
        }
    @Test
    public void xtestMapDec28(){
        String input = "prog main int x;boolean y;map[string,string] mapHash;x=12;x=12*3;y={};y={[x+y,10/12]};y[10]=20; print hello; println xyz*3;do(x>y) string new;new=\"Hello World\"; od;  do x:[y,z] y=y+z*20; od; if(g>s) mapHash[x]=y; fi; if(g<=s) mapHash[y]=x; else mapHash[x]=y; fi; x=x & !y; x=x-y; x=(x-y*20)/20; gorp";  //semi is the error, should be ident
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    
        }
    
    @Test
    public void xtestMapDec29(){
    	String input = "prog Test1 if (a) b=true; if (x==5) at=5; else at = 6; fi; if (x==5) a=w; fi; fi;  gorp";
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    
        }
    
    @Test
    public void xtestMapDec30(){
    	String input = "prog Test1 map[map[string,boolean],int] m; gorp";
        TokenStream stream = getInitializedTokenStream(input);
        Parser parser = new Parser(stream);
        AST tree;
		try {
			tree = parser.parse();
			 ToStringVisitor pv = new ToStringVisitor();
			 try {
				tree.visit(pv,"");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			 String s = pv.getString(); 
			 System.out.println(s);
		} catch (SyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    
        }


} 
